Skip to content

feat: Phase 1A system observability and diagnostics#39

Merged
zevorn merged 5 commits intomainfrom
feat/phase1a-observability
Mar 16, 2026
Merged

feat: Phase 1A system observability and diagnostics#39
zevorn merged 5 commits intomainfrom
feat/phase1a-observability

Conversation

@zevorn
Copy link
Owner

@zevorn zevorn commented Mar 16, 2026

Summary

  • Gateway statistics: track total/per-type/dropped/no-consumer message counts via gateway_get_stats()
  • Runtime log level: new OSAL API claw_log_set_level/get_level() with shell command /log level <error|warn|info|debug>, ESP-IDF backend syncs with esp_log_level_set()
  • Memory diagnostics: memory_info tool now reports largest contiguous free block and fragmentation percentage
  • Heartbeat health check: check_device_health() samples heap usage each ping cycle, auto-posts warning event when usage exceeds 80%, triggering AI summary on next tick

Test plan

  • meson compile passes on vexpress-a9 (zero warnings)
  • make build-esp32c3-qemu passes (zero warnings)
  • scripts/check-patch.sh --staged passes on all commits
  • QEMU boot test: make run-esp32c3-qemu — AI boot test passed

🦞 Generated with Claude Code

zevorn added 5 commits March 16, 2026 10:43
Track total/per-type/dropped/no-consumer message counts in
gateway dispatch loop. Expose via gateway_get_stats() for
shell diagnostics and heartbeat health reporting.

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
New OSAL API: claw_log_set_level() / claw_log_get_level() with
per-platform implementation. Messages above the configured level
are silently dropped. ESP-IDF backend also calls
esp_log_level_set() for consistent filtering.

Shell /log command extended: /log level <error|warn|info|debug>
to adjust verbosity at runtime without reboot.

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Add largest contiguous free block and fragmentation percentage
to the ESP-IDF memory_info tool output. Fragmentation is
calculated as (1 - largest_block / free_total) * 100%.

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Before the LLM ping, check_device_health() samples heap
usage from the platform API. When usage exceeds 80%, a
memory warning event is posted to the heartbeat buffer,
which triggers an AI summary on the next tick.

Platform-aware: ESP-IDF uses heap_caps API, RT-Thread
uses rt_memory_info().

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
architecture.md (en/zh):
- Gateway: document dispatch statistics API
- Heartbeat: describe three-layer tick logic (events -> health
  check + LLM ping -> state change notify)

usage.md (en/zh):
- Add /log level command to shell reference
- Update memory_info tool: largest block + fragmentation

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
@zevorn zevorn merged commit 9a7f932 into main Mar 16, 2026
9 checks passed
@zevorn zevorn deleted the feat/phase1a-observability branch March 16, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant